import 'package:afun_flutter/controllers/home_controller.dart';
import 'package:afun_flutter/view/index_page.dart';
import 'package:afun_flutter/view/order_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';


class HomePage extends StatelessWidget {
  const HomePage({super.key});


  @override
  Widget build(BuildContext context) {
    final controller = Get.find<HomeController>();

    return Scaffold(
        body: Obx(()=> IndexedStack(
          index:  controller.tabsCurrentIndex.value,
          children:  <Widget>[
            IndexPage(),
            OrderPage()
          ],
        )),
        bottomNavigationBar: Obx(()=> BottomNavigationBar( // 底部导航
          items: const <BottomNavigationBarItem>[
            BottomNavigationBarItem(icon: Icon(Icons.widgets_outlined), label: "菜单"),
            BottomNavigationBarItem(icon: Icon(Icons.receipt_long_outlined,), label: "订单"),

          ],
          currentIndex: controller.tabsCurrentIndex.value,
          fixedColor: const Color.fromRGBO(255, 87, 98, 1),
          onTap: controller.tabsCurrentChange,
        )),
    );
  }
}
